package string

import "sort"

type ReverseSort []string

func (s ReverseSort) Len() int           { return len(s) }
func (s ReverseSort) Less(i, j int) bool { return s[i] > s[j] }
func (s ReverseSort) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s ReverseSort) Sort()              { sort.Sort(s) }

type LengthSort []string

func (s LengthSort) Len() int { return len(s) }
func (s LengthSort) Less(i, j int) bool {
	if len(s[i]) == len(s[j]) {
		return s[i] > s[j]
	} else {
		return len(s[i]) > len(s[j])
	}
}

func (s LengthSort) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s LengthSort) Sort()         { sort.Sort(s) }
